﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LoginRadiusSDKv2;

public partial class Templates_Common_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] != null)
        {
            username_banner.Text = Session["username"].ToString();
            login.Text = "logout";
            signup.Visible = false;
            changePass.Visible = true;
        }
        else
        {
            //String value = Menu1.FindItem("home,home").ToString();
            username_banner.Text = null;
            login.Text = "login";
            changePass.Visible = false;
        }

        
    }
    
    protected void search2_Click(object sender, ImageClickEventArgs e)
    {
        
        String value = null;
        if(TxtSearch2.Text != null) value = TxtSearch2.Text;
        Response.Redirect("http://google.com/search?q=" + value);
    }

    protected void search_Click(object sender, ImageClickEventArgs e)
    {
        String value = null;
        if (TxtSearch.Text != null) value = TxtSearch.Text;
        Response.Redirect("http://google.com/search?q=" + value);
    }
    protected void login_Click(object sender, EventArgs e)
    {
        //logout
        if (Session["username"] != null)
        {             
            username_banner.Text = "login";
            Session["username"] = null;
            Session.Abandon();
            System.Web.Security.FormsAuthentication.SignOut();
        }
        Response.Redirect("~/login.aspx");
    }
}
